package com.sayimo.maker.user;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sayimo.maker.commons.Constant;
import com.sayimo.maker.commons.utils.Base64Utils;
import com.sayimo.maker.commons.utils.CbcEncrypt;
import com.sayimo.maker.commons.utils.MD5Util;
import com.sayimo.maker.user.service.CustomerInterfaceService;
import com.sayimo.maker.user.service.EnterpriseInfoService;
import com.sayimo.maker.user.service.EnterpriseWalletInterfaceService;
import com.sayimo.maker.user.service.ProvinceInterfaceService;
import com.sayimo.maker.user.service.ReceivingAddressInterfaceService;
import com.sayimo.maker.user.service.SmsVerifyCodeInterfaceService;
import com.sayimo.maker.user.service.WalletInterfaceService;
import com.sayimo.maker.user.vo.Customer;
import com.sayimo.maker.user.vo.EnterpriseInfo;
import com.sayimo.maker.user.vo.EnterpriseWallet;
import com.sayimo.maker.user.vo.ReceivingAddress;
import com.sayimo.maker.user.vo.Wallet;

@Controller
@RequestMapping("/user")
public class UserController {
	private static Log logger = LogFactory.getLog(UserController.class);
	@Resource(name = "customerInterfaceImplService")
	public CustomerInterfaceService customerInterfaceService;
	@Resource(name = "smsVerifyCodeInterfaceImplService")
	public SmsVerifyCodeInterfaceService smsVerifyCodeInterfaceImplService;
	@Resource(name = "walletInterfaceService")
	private WalletInterfaceService walletInterfaceService;
	@Resource(name = "provinceInterfaceImplService")
	private ProvinceInterfaceService provinceInterfaceService;
	@Resource(name = "receivingAddressInterfaceImplService")
	private ReceivingAddressInterfaceService receivingAddressInterfaceImplService;
	@Resource(name = "enterpriseInfoService")
	private EnterpriseInfoService enterpriseInfoService;
	@Autowired
	private EnterpriseWalletInterfaceService enterpriseWalletInterfaceService;
	/**
	 * @Package com.sayimo.maker.web.user
	 * @Author 龚益君
	 * @MethodName:enterpriseLogin
	 * @Description:登录
	 * @param request
	 * @return
	 * @Date 2016年12月30日,上午10:44:12
	 */
	@RequestMapping(value = "/makerlogin", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> makerlogin(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			Customer customer = new Customer();
			customer.setAccout(request.getParameter("customerAccount"));
			customer.setMobilePhone(request.getParameter("customerAccount"));
			customer.setPassWord(Base64Utils.decodeBase64(request.getParameter("passWord")));
			customer.setDeviceToken(request.getParameter("deviceToken"));
			customer.setDeviceType(Integer.valueOf(request.getParameter("deviceType")));
			resultMap = customerInterfaceService.makerLogin(customer);

		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * @Package com.sayimo.maker.web.user
	 * @Author 龚益君
	 * @MethodName:registerAccount
	 * @Description:注册
	 * @param request
	 * @return
	 * @Date 2016年12月30日,上午10:44:19
	 */
	@RequestMapping(value = "/registeraccount", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> registerAccount(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			Customer customer = new Customer();
			customer.setAccout(request.getParameter("customerAccount"));
			customer.setPassWord(Base64Utils.decodeBase64(request.getParameter("passWord")));
			customer.setMobilePhone(request.getParameter("mobilePhone"));
			customer.setInviteCode(request.getParameter("inviteCode"));
			String busCode=request.getParameter("busCode");
			resultMap = customerInterfaceService.makerRegister(customer, busCode);

		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}
	/**
	 * @Package com.sayimo.maker.user
	 * @Author 谭新
	 * @MethodName: createQrCode
	 * @Description:将传入的文本重新生成二维码
	 * @return Map<String,Object>
	 * @Date 2017年4月6日,上午11:18:40
	 */
	@RequestMapping(value = "/createqrcode", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> createQrCode(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			String qrCodeUrl=request.getParameter("qrCodeUrl");
			logger.info("&&&&&&&&&&&&&&&&&&&qrCodeUrl==="+qrCodeUrl);
			resultMap = customerInterfaceService.createQrCode(qrCodeUrl);

		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * 
	 * @Title: getUserInfo
	 * @Author: 田超
	 * @Date:日期：2017年2月18日 : 上午9:15:58
	 * @Description:个人中心首页,用户信息
	 * @return Map<String,Object>
	 * @Version 1.0.0
	 */
	@RequestMapping(value = "/getuserinfo", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> getUserInfo(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			String accout= request.getAttribute("accout").toString();
			resultMap = customerInterfaceService.getUserInfo(accout);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}

	/**
	 * 
	 * @Title: getUserDetail
	 * @Author: 田超
	 * @Date:日期：2017年2月18日 : 上午9:17:44
	 * @Description:个人中心,个人资料
	 * @return Map<String,Object>
	 * @Version 1.0.0
	 */
	@RequestMapping(value = "/getuserdetail", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> getUserDetail(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			String accout=(String) request.getAttribute("accout");
			resultMap = customerInterfaceService.getUserDetail(accout);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}

	/**
	 * 
	 * @Title: updateCustomerInfo
	 * @Author: 田超
	 * @Date:日期：2017年2月18日 : 上午9:19:21
	 * @Description:更新用户信息
	 * @return Map<String,Object>
	 * @Version 1.0.0
	 */
	@RequestMapping(value = "/updatecustomerinfo", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> updateCustomerInfo(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = customerInterfaceService.updateCustomerInfo(request);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}

	/**
	 * 
	 * @Title: getCustomerNum
	 * @Author: 田超
	 * @Date:日期：2017年2月18日 : 上午9:23:06
	 * @Description:会员管理
	 * @return Map<String,Object>
	 * @Version 1.0.0
	 */
	@RequestMapping(value = "/getcustomernum", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> getCustomerNum(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			String accout = (String) request.getAttribute("accout");
			resultMap = customerInterfaceService.getCustomerNum(accout);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}

	/**
	 * 
	 * @Title: applyProvider
	 * @Author: 田超
	 * @Date:日期：2017年2月21日 : 下午2:29:45
	 * @Description:申请联盟商和供应商
	 * @return Map<String,Object>
	 * @Version 1.0.0
	 */
	@RequestMapping(value = "/applyprovider", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> applyProvider(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = enterpriseInfoService.insertProviderAndUnion(request);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}

	/**
	 * 
	 * @Title: sendSms
	 * @Author: 田超
	 * @Date:日期：2016年12月2日 时间：下午6:27:47
	 * @Description: 发送验证信息
	 * @param request
	 * @return
	 * @return Map<String,Object>
	 * @Version 1.0.0
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/sendsms", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> sendSms(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = smsVerifyCodeInterfaceImplService.sendSms(request);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}

	/**
	 * 
	 * @Title: CheckSms
	 * @Author: 田超
	 * @Date:日期：2016年12月2日 时间：下午6:31:18
	 * @Description: 检查验证码
	 * @param request
	 * @return
	 * @return Map<String,Object>
	 * @Version 1.0.0
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/checksms", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> CheckSms(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = smsVerifyCodeInterfaceImplService.checkSmsCode(request);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}

	/**
	 * @Package com.sayimo.maker.web.user
	 * @Author TANXIN
	 * @MethodName:lowerLevelMembers
	 * @Description:获取所有的下级会员信息
	 * @param parentId
	 * @return
	 * @Date 2017年1月3日,下午6:12:45
	 */
	@RequestMapping(value = "/getchildrenmember/{parentId}", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> lowerLevelMembers(@PathVariable("parentId") String parentId) {

		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = customerInterfaceService.queryAllLowerLevelMembers(Integer.valueOf(parentId));
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * @Package com.sayimo.maker.web.user
	 * @Author TANXIN
	 * @MethodName:bindPhoneNum
	 * @Description: 绑定手机
	 * @param request
	 * @return
	 * @Date 2017年1月3日,下午6:12:37
	 */
	@RequestMapping(value = "/bindphonenum", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> bindPhoneNum(HttpServletRequest request) {

		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			String mobilePhone = request.getParameter("mobilePhone");
			String customerId = request.getParameter("customerId");
			String smsCode = request.getParameter("smsCode");
			resultMap = customerInterfaceService.updateUn_BindPhone(mobilePhone, customerId, smsCode,
					Constant.SMS_BUS_CODE_002);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * @Package com.sayimo.maker.web.user
	 * @Author TANXIN
	 * @MethodName:unBindPhoneNum
	 * @Description:解绑手机
	 * @param request
	 * @return
	 * @Date 2017年1月3日,下午6:12:28
	 */
	@RequestMapping(value = "/unbindphonenum", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> unBindPhoneNum(HttpServletRequest request) {

		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			String mobilePhone = request.getParameter("mobilePhone");
			String customerId = request.getParameter("customerId");
			String smsCode = request.getParameter("smsCode");
			resultMap = customerInterfaceService.updateUn_BindPhone(mobilePhone, customerId, smsCode,
					Constant.SMS_BUS_CODE_003);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * @Package com.sayimo.maker.web.user
	 * @Author TANXIN
	 * @MethodName:getPersonalCenterCount
	 * @Description:个人中心“未付款、待收货、待评论、我的佣金”统计
	 * @param customerId
	 * @return
	 * @Date 2017年1月3日,下午6:12:06
	 */
	@RequestMapping(value = "/getpersonalcentercount/{mallType}", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> getPersonalCenterCount(HttpServletRequest request ,@PathVariable("mallType") Integer mallType) {
		Customer customer = new Customer();
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			Integer customerId= (Integer) request.getAttribute("customerId");
			customer.setId(customerId);
			resultMap = customerInterfaceService.queryOrdersListCntByStatus(customer,mallType);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * @Package com.sayimo.maker.web.user
	 * @Author TANXIN
	 * @MethodName:selectaccountinfo
	 * @Description:查询账号信息
	 * @param customerId
	 * @return
	 * @Date 2017年1月4日,上午10:51:16
	 */
	@RequestMapping(value = "/selectaccountinfo/{customerId}", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> selectaccountinfo(@PathVariable("customerId") String customerId) {
		Customer customer = new Customer();
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			customer.setId(Integer.parseInt(customerId));
			List<Customer> list = new ArrayList<Customer>();
			list = customerInterfaceService.queryCustomerByCond(customer);
			resultMap.put("accountInfo", list);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * @Package com.sayimo.union.web.user.controller
	 * @Author TANXIN
	 * @MethodName:updateAccountInfo
	 * @Description:更新个人账号信息
	 * @param request
	 * @return
	 * @Date 2016年12月3日,上午11:41:49
	 */
	@RequestMapping(value = "/updateaccountinfo", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> updateAccountInfo(Customer customer) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			/*
			 * if (customer.getBirthdayLong() != null) {
			 * customer.setBirthday(DateUtil.timestampToDate(customer.
			 * getBirthdayLong())); }
			 */
			resultMap = customerInterfaceService.updateCustomer(customer);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}

	/**
	 * 
	 * @Title: updatePassword
	 * @Author: 田超
	 * @Date:日期：2016年12月3日 时间：上午11:42:26
	 * @Description: 忘记密码情况下密码修改
	 * @return
	 * @return Map<String,Object>
	 * @Version 1.0.0
	 */
	@RequestMapping(value = "/updatepassword", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> updatePassword(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = customerInterfaceService.updatePassword(request);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}

	/**
	 * 
	 * @Title: modifyPassword
	 * @Author: 田超
	 * @Date:日期：2016年12月5日 时间：上午11:28:35
	 * @Description: 自己修改密码
	 * @param request
	 * @return
	 * @return Map<String,Object>
	 * @Version 1.0.0
	 */
	@RequestMapping(value = "/modifypassword", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> modifyPassword(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = customerInterfaceService.updateModifyPassword(request);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}

	/**
	 * 
	 * @Title: modifyPhone
	 * @Author: 田超
	 * @Date:日期：2016年12月5日 时间：下午2:43:34
	 * @Description: 修改绑定手机号
	 * @return
	 * @return Map<String,Object>
	 * @Version 1.0.0
	 */
	@RequestMapping(value = "/modifyphone", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> modifyPhone(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = customerInterfaceService.updateModifyPhone(request);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}

	/**
	 * 
	 * @Title: clearProviderToken
	 * @Author: 田超
	 * @Date:日期：2016年12月12日 时间：下午2:20:32
	 * @Description: 商家主动退出登录
	 * @param providerAccout
	 * @return
	 * @return Map<String,Object>
	 * @Version 1.0.0
	 */
	@RequestMapping(value = "/clearprovidertoken", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> clearProviderToken(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = customerInterfaceService.clearProviderToken(request);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}

	/**
	 * @Package com.sayimo.maker.web.user
	 * @Author 龚益君
	 * @MethodName:validateWalletPassWord
	 * @Description:是否设置钱包密码
	 * @param customerId
	 * @return
	 * @Date 2017年1月10日,下午4:55:11
	 */
	@RequestMapping(value = "/existwalletpaypwd", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> validateWalletPassWord(HttpServletRequest request ) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			Integer customerId=(Integer) request.getAttribute("customerId");
			Wallet wallet = walletInterfaceService.queryWalletByCustomerId(customerId);
			if (StringUtils.isNotEmpty(wallet.getPassWord())) {
				resultMap.put(Constant.STATUS, Constant.STATUS_SUCCESS);
				resultMap.put(Constant.DATA, 1);
			} else {
				resultMap.put(Constant.STATUS, Constant.STATUS_SUCCESS);
				resultMap.put(Constant.DATA, 0);
			}
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}

	/**
	 * @Package com.sayimo.maker.web.user
	 * @Author 龚益君
	 * @MethodName:createWalletPassword
	 * @Description:
	 * @param request
	 * @return
	 * @Date 2017年1月11日,下午2:35:07
	 */
	@RequestMapping(value = "/setwalletpaypwd", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> createWalletPassword(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			Wallet wallet = new Wallet();
			wallet.setPassWord(Base64Utils.decodeBase64(request.getParameter("password")));
			Integer customerId = (Integer) request.getAttribute("customerId");
			wallet.setCustomerId(customerId);
			resultMap = walletInterfaceService.createWalletPassword(wallet);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}

	/**
	 * @Package com.sayimo.maker.web.user
	 * @Author 龚益君
	 * @MethodName:updateMoneyPwd
	 * @Description:修改钱包密码
	 * @param request
	 * @return
	 * @Date 2017年1月11日,下午2:42:08
	 */
	@RequestMapping(value = "/editwalletpaypwd", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> updateMoneyPwd(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			Wallet wallet = new Wallet();
			wallet.setOldPassword(MD5Util.MD5Encode(CbcEncrypt.encrypt(Base64Utils.decodeBase64(request.getParameter("oldPassword"))), "UTF-8"));
			wallet.setCustomerId((Integer)request.getAttribute("customerId"));
			wallet.setPassWord(MD5Util.MD5Encode(CbcEncrypt.encrypt(Base64Utils.decodeBase64(request.getParameter("newPassword"))), "UTF-8"));
			resultMap = walletInterfaceService.updateMoneyPwd(wallet);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}

	/**
	 * @Title: getAllProvinces
	 * @Description: 获取所有省份
	 * @return String
	 */
	@RequestMapping(value = "/getallprovinces", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> getAllProvinces() {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = provinceInterfaceService.queryProvince();
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * @Title: getAllCities
	 * @Description: 获取某省下面所有城市
	 * @return String
	 */
	@RequestMapping(value = "/getcitiesbyprovincecode/{provinceCode}", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> getAllCities(@PathVariable("provinceCode") String provinceCode) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = provinceInterfaceService.queryCity(provinceCode);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * @Title: getAllAreas
	 * @Description: 获取某市下面所有地区
	 * @return String
	 */
	@RequestMapping(value = "/getareasbycitycode/{cityCode}", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> getAllAreas(@PathVariable("cityCode") String cityCode) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = provinceInterfaceService.queryArea(cityCode);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * @Title: getAddressByAreaCode
	 * @Description: 根据区县编码获取省市县信息
	 * @return String
	 */
	@RequestMapping(value = "/getaddressbyareacode/{areaCode}", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> getAddressByAreaCode(@PathVariable("areaCode") String areaCode) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = provinceInterfaceService.queryAddressByArea(areaCode);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * 
	 * @MethodName getReceiveAddress
	 * @Description 获取“我”的收货地址
	 * 
	 * @author chenpy
	 * @date 2015年12月25日 下午2:31:55
	 * @param
	 * @return String
	 * @VERSION 1.0.0
	 */
	@RequestMapping(value = "/getreceiveaddress", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> getReceiveAddress(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			ReceivingAddress receivingAddress = new ReceivingAddress();
			Integer customerId=(Integer) request.getAttribute("customerId");
			receivingAddress.setCustomerId(customerId);
			resultMap = receivingAddressInterfaceImplService.getReceiveAddressAPI(receivingAddress);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * 
	 * @MethodName getReceiveAddressById
	 * @Description 获取“我”的收货地址
	 * 
	 * @author chenpy
	 * @date 2015年12月25日 下午2:31:55
	 * @param
	 * @return String
	 * @VERSION 1.0.0
	 */
	@RequestMapping(value = "/getreceiveaddressbyid/{id}", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> getReceiveAddressById(@PathVariable("id") Integer id) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			ReceivingAddress receivingAddress = new ReceivingAddress();
			receivingAddress.setId(id);
			resultMap = receivingAddressInterfaceImplService.getReceiveAddressByIdAPI(receivingAddress);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * 
	 * @MethodName updateReceiveAddressById
	 * @Description 修改收货地址
	 * 
	 * @author chenpy
	 * @date 2015年12月25日 下午2:31:55
	 * @param
	 * @return String
	 * @VERSION 1.0.0
	 */
	@RequestMapping(value = "/updatereceiveaddressbyid", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> updateReceiveAddressById(ReceivingAddress receivingAddress) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = receivingAddressInterfaceImplService.updateByPrimaryKeySelective(receivingAddress);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * @Package com.sayimo.maker.web.user
	 * @Author 龚益君
	 * @MethodName:setDefaultReceivingAddress
	 * @Description:设置默认收货地址
	 * @param receivingAddress
	 * @return
	 * @Date 2017年1月12日,下午6:00:24
	 */
	@RequestMapping(value = "/setdefaultreceivingaddress", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> setDefaultReceivingAddress(ReceivingAddress receivingAddress,HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			receivingAddress.setCustomerId((Integer) request.getAttribute("customerId"));
			resultMap = receivingAddressInterfaceImplService.insertSelective(receivingAddress);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * 
	 * @MethodName addReceiveAddress
	 * @Description 添加收货地址
	 * 
	 * @author chenpy
	 * @date 2015年12月25日 下午2:31:55
	 * @param
	 * @return String
	 * @VERSION 1.0.0
	 */
	@RequestMapping(value = "/addreceiveaddress", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> addReceiveAddress(ReceivingAddress receivingAddress,HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			Integer customerId= (Integer) request.getAttribute("customerId");
			receivingAddress.setCustomerId(customerId);
			resultMap = receivingAddressInterfaceImplService.insertSelective(receivingAddress);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * 
	 * @MethodName deleteReceiveAddressById
	 * @Description 删除收货地址
	 * 
	 * @author chenpy
	 * @date 2015年12月25日 下午2:31:55
	 * @param
	 * @return String
	 * @VERSION 1.0.0
	 */
	@RequestMapping(value = "/deletereceiveaddressbyid", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> deleteReceiveAddressById(ReceivingAddress receivingAddress) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = receivingAddressInterfaceImplService.deleteByPrimaryKey(receivingAddress.getId());
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * @Package com.sayimo.school.mall.module.admin.action
	 * @Author 龚益君
	 * @MethodName:getAllAreaAsJson
	 * @Description:获取所有省份城市信息为Json数组
	 * @Date 2016年5月31日,下午6:12:18
	 */
	@RequestMapping(value = "/getallasjson", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> getAllAreaAsJson() {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = provinceInterfaceService.queryAllAsJson();
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * @Package com.sayimo.school.mall.module.admin.action
	 * @Author 龚益君
	 * @MethodName:getAllAreaAsJson
	 * @Description:获取指定编号的省市区为json数组
	 * @Date 2016年5月31日,下午6:12:18
	 */
	@RequestMapping(value = "/getareabycodeasjson/{areaCode}", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> getAreaByCodeAsJson(@PathVariable("areaCode") String areaCode) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = provinceInterfaceService.queryAddressByAreaCode(areaCode);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * @Package com.sayimo.maker.web.user
	 * @Author 龚益君
	 * @MethodName:listWalletInOutDetail
	 * @Description:会员收支明细
	 * @param customerId
	 * @return
	 * @Date 2017年1月12日,上午10:56:13 =
	 */
	@RequestMapping(value = "/getinoutdetails/{queryType}/{rewardType}/{pageNow}/{pageSize}", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> listWalletInOutDetail(HttpServletRequest request,
			@PathVariable("queryType") Integer queryType,
			@PathVariable("rewardType") Integer rewardType,
			@RequestParam(value = "orderType", required = false) String orderType,
			@PathVariable("pageNow")Integer pageNow,
			@PathVariable("pageSize")Integer pageSize,
			@RequestParam(value = "transferStatus", required = false) String transferStatus) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			Integer customerId =(Integer) request.getAttribute("customerId");
			resultMap = walletInterfaceService.listWalletInOutDetail(customerId, queryType,rewardType,orderType,pageNow,pageSize,transferStatus);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}
	/**
	 * @Package com.sayimo.maker.web.user
	 * @Author cwy
	 * @MethodName:listWalletInOutDetail
	 * @Description:企业收支明细
	 * @param customerId
	 * @return
	 * @Date 2017年1月12日,上午10:56:13 =
	 */
	@RequestMapping(value = "/getenterpriseinoutdetails/{queryType}/{rewardType}/{pageNow}/{pageSize}", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> listEnterpriseWalletInOutDetail(HttpServletRequest request,
			@PathVariable("queryType") Integer queryType,
			@PathVariable("rewardType") Integer rewardType,
			@RequestParam(value = "orderType", required = false) String orderType,
			@PathVariable("pageNow")Integer pageNow,
			@PathVariable("pageSize")Integer pageSize,
			@RequestParam(value = "transferStatus", required = false) String transferStatus) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			Integer customerId =(Integer) request.getAttribute("customerId");
			resultMap = enterpriseWalletInterfaceService.listEnterpriseWalletInOutDetail(customerId, queryType,rewardType,orderType,pageNow,pageSize,transferStatus);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}
	/**
	 * @Package com.sayimo.maker.web.user
	 * @Author 龚益君
	 * @MethodName:queryWalletInfo
	 * @Description:个人钱包信息
	 * @param customerId
	 * @return
	 * @Date 2017年1月12日,上午10:58:26
	 */
	@RequestMapping(value = "/getwalletbycustomerid", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> queryWalletInfo(HttpServletRequest request ) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			Integer customerId=(Integer) request.getAttribute("customerId");
			resultMap = walletInterfaceService.queryWalletInfo(customerId);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * @package com.sayimo.maker.user
	 * @author chenpy
	 * @Title:
	 * @Description:会员绑定银行卡/支付宝
	 * @param
	 * @throws @return
	 * @date 2017-02-20 上午11:37:30
	 */
	@RequestMapping(value = "/bindbankcard", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> bindBankCard() {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = customerInterfaceService.bindBankCard();
		} catch (Exception e) {
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
		}
		return resultMap;
	}

	/**
	 * @package com.sayimo.maker.user
	 * @author chenpy
	 * @Title:
	 * @Description:创客申请
	 * @param
	 * @throws @return
	 * @date 2017-02-20 上午11:37:30
	 */
	@RequestMapping(value = "/applymaker", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> applyMaker() {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = customerInterfaceService.applyMaker();
		} catch (Exception e) {
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
		}
		return resultMap;
	}

	/**
	 * @package com.sayimo.maker.user
	 * @author chenpy
	 * @Title:
	 * @Description:创客申请回掉
	 * @param
	 * @throws @return
	 * @date 2017-02-20 上午11:37:30
	 */
	@RequestMapping(value = "/applymakercallback", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> applyMakerCallback(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			Integer customerId = (Integer) request.getAttribute("customerId");
			 String	tradeNo=request.getParameter("tradeNo");
			 Integer ownAwardRule=Integer.valueOf(request.getParameter("ownAwardRule"));
			resultMap = customerInterfaceService.applyMakerCallback(customerId, tradeNo,ownAwardRule);
		} catch (Exception e) {
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
		}
		return resultMap;
	}

	/**
	 * @package com.sayimo.maker.user
	 * @author chenpy
	 * @Title: rechargeSilverScore
	 * @Description:用户充值（银积分）
	 * @param
	 * @throws @return
	 * @date 2017-02-20 上午11:37:30
	 */
	@RequestMapping(value = "/rechargesilverscore", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> rechargeSilverScore(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			String passWord=null;
			if(request.getParameter("passWord")!=null && !"".equals(request.getParameter("passWord"))){
				passWord= MD5Util.MD5Encode(CbcEncrypt.encrypt(Base64Utils.decodeBase64(request.getParameter("passWord"))), "UTF-8");
			}
			
			resultMap = customerInterfaceService.rechargeSilverScore(passWord);
		} catch (Exception e) {
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
		}
		return resultMap;
	}

	/**
	 * @package com.sayimo.maker.user
	 * @author chenpy
	 * @Title: rechargeSilverScoreCallback
	 * @Description:用户充值（银积分）回调
	 * @param
	 * @throws @return
	 * @date 2017-02-20 上午11:37:30
	 */
	@RequestMapping(value = "/rechargesilverscorecallback", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> rechargeSilverScoreCallback(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
		    Integer	customerId=(Integer) request.getAttribute("customerId");
		    String	tradeNo=request.getParameter("tradeNo");
			resultMap = customerInterfaceService.rechargeSilverScoreCallback(customerId, tradeNo);
		} catch (Exception e) {
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
		}
		return resultMap;
	}
	
	
	/**
	 * @package com.sayimo.maker.user
	 * @author 龚益君
	 * @Title: queryEnterpriseInfo
	 * @Description:查询与用户绑定的商户信息
	 * @param
	 * @throws @return
	 * @date 2017-02-20 上午11:37:30
	 */
	@RequestMapping(value = "/getenterpriseinfo/{account}", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> queryEnterpriseInfo(@PathVariable("account") String account) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = enterpriseInfoService.queryEnterpriseInfo(account);
		} catch (Exception e) {
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
		}
		return resultMap;
	
	}
	/**
	 * @package com.sayimo.maker.user
	 * @author wangyang
	 * @Title: unionscancodepay
	 * @Description:用户扫联盟商二维码支付
	 * @param
	 * @throws @return
	 * @date 2017-03-07 下午16:38:30
	 */
	@RequestMapping(value = "/unionscancodepay", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> unionScanCodePay() {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = customerInterfaceService.unionScanCodePay();
		} catch (Exception e) {
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
		}
		return resultMap;
	}
	
	/**
	 * @package com.sayimo.maker.user
	 * @author wangyang
	 * @Title: unionScanCodePayCallback
	 * @Description:用户扫联盟商二维码支付回调
	 * @param
	 * @throws @return
	 * @date 2017-03-07 下午17:20:05
	 */
	@RequestMapping(value = "/unionscancodepaycallback", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> unionScanCodePayCallback(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
		    String	tradeNo=request.getParameter("tradeNo");
		    String  consumerOrdersNo=request.getParameter("consumerOrdersNo");
			resultMap = customerInterfaceService.unionScanCodePayCallback(tradeNo,consumerOrdersNo);
		} catch (Exception e) {
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
		}
		return resultMap;
	}
	
	/**
	 * @Package com.sayimo.rainbow.web.user
	 * @Author TANXIN
	 * @MethodName:memberMustReadList
	 * @Description:会员必读/关于我们列表
	 * @param mark
	 * @return
	 * @Date 2017年1月3日,下午6:12:18
	 */
	@RequestMapping(value = "/getmembersmustread/{mark}", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> memberMustReadList(@PathVariable("mark") String mark) {

		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = customerInterfaceService.queryMemberMustReadList(mark);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
		return resultMap;
	}
	
	/**
	 * @package com.sayimo.maker.user
	 * @author chenpy
	 * @Title:
	 * @Description:银星创客升级成为金星创客
	 * @param
	 * @throws @return
	 * @date 2017-02-20 上午11:37:30
	 */
	@RequestMapping(value = "/upgradegoldmaker", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> upgradeGoldMaker() {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = customerInterfaceService.upgradeGoldMaker();
		} catch (Exception e) {
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
		}
		return resultMap;
	}

	/**
	 * @package com.sayimo.maker.user
	 * @author chenpy
	 * @Title:
	 * @Description:创客申请回掉
	 * @param
	 * @throws @return
	 * @date 2017-02-20 上午11:37:30
	 */
	@RequestMapping(value = "/upgradegoldmakercallback", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> upgradeGoldMakerCallback(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			
			Integer customerId = (Integer) request.getAttribute("customerId");
			 String	tradeNo=request.getParameter("tradeNo");
			resultMap = customerInterfaceService.upgradeGoldMakerCallback(customerId, tradeNo);
		} catch (Exception e) {
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
		}
		return resultMap;
	}
	/**
		 * @Package com.sayimo.maker.user
		 * @Author 谭新
		 * @MethodName: updateProvider
		 * @Description:修改供应商
		 * @return Map<String,Object>
		 * @Date 2017年3月14日,上午9:09:45
		 */
	@RequestMapping(value = "/updateprovider", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> updateProvider(EnterpriseInfo enterpriseInfo) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = enterpriseInfoService.updateProviderAndUnion(enterpriseInfo);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}
	
	/**
	 * @Package com.sayimo.maker.user
	 * @Author wangyang
	 * @MethodName: personalwalletbetocash
	 * @Description:用户钱包提现
	 * @return Map<String,Object>
	 * @Date 2017年3月15日,上午10:16:45
	 */
	@RequestMapping(value = "/personalwalletbetocash", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> personalWalletBeToCash(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			
			Integer customerId = (Integer) request.getAttribute("customerId");

			String payPrice = request.getParameter("payPrice");
			String passWord= MD5Util.MD5Encode(CbcEncrypt.encrypt(Base64Utils.decodeBase64(request.getParameter("passWord"))), "UTF-8");
			resultMap = customerInterfaceService.personalWalletBeToCash(customerId,payPrice,passWord);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}
	/**
	 * @Package com.sayimo.maker.user
	 * @Author 谭新
	 * @MethodName: verifyMoneyPwd
	 * @Description:验证钱包密码
	 * @return Map<String,Object>
	 * @Date 2017年3月22日,上午11:41:32
	 */
	@RequestMapping(value = "/verifywalletpaypwd", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> verifyMoneyPwd(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			Wallet wallet = new Wallet();			
			wallet.setPassWord(MD5Util.MD5Encode(CbcEncrypt.encrypt(Base64Utils.decodeBase64(request.getParameter("passWord"))), "UTF-8"));
			Integer customerId = (Integer) request.getAttribute("customerId");
			wallet.setCustomerId(customerId);
			resultMap = walletInterfaceService.verifyMoneyPwd(wallet);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}
	 /**
	 * @Package com.sayimo.maker.user
	 * @Author 龚益君
	 * @MethodName:updateEnterpriseWalletInfo
	 * @Description:修改企业钱包捆绑银行账号信息
	 * @param request
	 * @param wallet
	 * @return
	 * @Date 2017年4月17日,上午11:34:19
	 */
	@RequestMapping(value = "/updateenterprisewallet", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> updateEnterpriseWalletInfo(HttpServletRequest request,EnterpriseWallet wallet) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {	
			Integer customerId = (Integer) request.getAttribute("customerId");
			wallet.setUpdateUser(customerId);
			resultMap = customerInterfaceService.updateEnterpriseWalletInfo(wallet);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}
	 /**
	 * @Package com.sayimo.maker.user
	 * @Author 龚益君
	 * @MethodName:queryEnterpriseWalletInfo
	 * @Description:获取商企钱包信息
	 * @param customerId
	 * @return
	 * @Date 2017年4月17日,下午2:38:08
	 */
	@RequestMapping(value = "/queryenterprisewalletinfo", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> queryEnterpriseWalletInfo(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			Integer customerId = (Integer) request.getAttribute("customerId");
			resultMap = customerInterfaceService.queryEnterpriseWalletInfo(customerId);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}
	 /**
	 * @Package com.sayimo.maker.user
	 * @Author 龚益君
	 * @MethodName:queryAllBankBranch
	 * @Description:根据地区编码和总行编码获取地区下所有支行
	 * @param code
	 * @param bankCode
	 * @return
	 * @Date 2017年4月17日,下午4:04:44
	 */
	@RequestMapping(value = "/queryallbankbranch/{code}/{bankCode}", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> queryAllBankBranch(@PathVariable("code") String code,@PathVariable("bankCode") String bankCode) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = customerInterfaceService.queryAllBankBranch(code, bankCode);
		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
		}
		return resultMap;
	}
	
}